<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>教室后台-不学也通</title>
    <style> 
        .container{
            min-height: 100vh;
        }
        .container.nav{
            min-height: 100vh;
            background-color: #fff;
        }

        .link-secondary{
            text-decoration: none;
        }
        .link-secondary:hover{
            color: #0d6efd !important;
        }
        td img{
            max-width: 120px;
        }
    </style>
</head>
<body>
    <!--container是bootstrap的居中窄的显示方案-->
    <div class="container bg-body-secondary">
        <div class="row">
            <div class="col-md-2 leftmenu" id="leftmenu"></div>
                    <div class="col-md-9 kc ms-3">
                        <div class="row mt-3 pb-1 border-bottom border-secondary">
                            <div class="col-md-2">添加班级</div>
                            <div class="col-md-1 offset-md-8">
                                <a class="nav-link link-success" href="#">返回</a>
                            </div>
                        </div>
                        <div class="row">
                            <form>
                                <div class="mb-3 row">
                                    <label for="class_code" class="col-sm-2 col-form-label">班级编号:</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="class_code">
                                    </div>
                                </div>
                                <div class="mb-3 row">
                                    <label for="course-name" class="col-sm-2 col-form-label">班级名称:</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="class_name">
                                    </div>
                                </div>
                                <div class="mb-3 row">
                                    <label for="course-department" class="col-sm-2 col-form-label">年级:</label>
                                    <div class="col-sm-10">
                                        <select class="form-select" name="" id="grade_code">
                                            <option selected>--请选择年级--</option>
                                            <option value="1">2021级</option>
                                            <option value="2">2022级</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="mb-3 row">
                                    <label for="class_logo" class="col-sm-2 col-form-label">班级logo:</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="class_logo">
                                    </div>
                                </div>
                                <div class="mb-3 row">
                                    <label for="class_numder" class="col-sm-2 col-form-label">班级人数</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="class_logo">
                                    </div>
                                </div>
                                <div class="col-sm-12"></div>
                                <button type="submit" class="btn btn-outline-primary">提交</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div> 
        </div>
    </div>
    <script type="module" src="../js/main.js"></script>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/common.js"></script>
    <script>
        $(document).ready(function(){
            $(".btn-outline-primary").click(function(){
                let class_code = $("class_code").val()
                let class_name = $("#class_name").val()
                let class_logo = $("#class_logo").val()
                let class_number = $("#class_number").val()
                let grade_code = $("#grade_code").val()
                
                $.post("http://unicloud.codecore.cn/ms/classCreate",{
                    class_code:class_code,
                    class_name:class_name,
                    class_logo:class_logo,
                    class_number:class_number,
                    grade_code:grade_code,
                    school_code:50709,
                    department_code:200,
                    majors_code: 3
                },function(params) {
                    if(params.errCode == 0){
                        location.href = "./class,html"
                    }else{
                        alert("添加失败")
                    }
                })
            })
        })
    </script>
</body>
</html>